package com.example.lotterysystem.common.exception;

import com.example.lotterysystem.common.errorcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
//date仅仅生成自己的 equals hashcode
@EqualsAndHashCode(callSuper = true)
public class ControllerException extends RuntimeException {
//    异常码
    private Integer code;
//    异常消息
    private String message;
//    为了序列化
    public ControllerException(){

    }
    public ControllerException(Integer code,String message){
        this.code=code;
        this.message=message;
    }
    public ControllerException(ErrorCode errorCode){
        this.code=errorCode.getCode();
        this.message=errorCode.getMsg();
    }

}
